package com.heima.wemedia.controller.admin;

import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.admin.dtos.SensitivePageDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.wemedia.service.WmSensitiveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;


@RequestMapping
@Slf4j
@Api("admin要用的敏感词")
@RequiredArgsConstructor
@RestController
public class SensitiveController {
    private final WmSensitiveService wmSensitiveService;
    @ApiOperation("分页查询敏感词")
    @PostMapping("/admin/sensitive/list")
    public ResponseResult queryPageSensitive(@RequestBody SensitivePageDto dto){
        log.info("要检查敏感词的分页参数为{}",dto);
        return wmSensitiveService.queryPageSensitive(dto);
    }
    @ApiOperation("添加敏感词")
    @PostMapping("/admin/sensitive/add")
    public ResponseResult addSenistove(@RequestBody SensitiveDto dto){
        log.info("要添加的敏感词的参数为{}",dto);
        return wmSensitiveService.addSenistive(dto);
    }
    @ApiOperation(("修改敏感词"))
    @PostMapping("/admin/sensitive/modify")
    public ResponseResult modifySensitive(@RequestBody SensitiveDto dto){
        log.info("要修改的敏感词的参数为{}",dto);
        return wmSensitiveService.modifySenistive(dto);
    }
    @ApiOperation("删除单个敏感词")
    @PostMapping("/admin/sensitive/delete")
    public ResponseResult deleteSensitive(@RequestBody String id){
        log.info("要删除的敏感词的参数为{}",id);
        return wmSensitiveService.deleteSenistive(id);
    }
    @ApiOperation("敏感词校验")
    @PostMapping("/comment/sensitive/panduan")
    public Boolean panduanSenistive(@RequestBody String content){
        log.info("要进行校验的评论内容为{}",content);
        return wmSensitiveService.panduanSenistive(content);
    }
}
